

export const  getDate = function(n){
    if(n==""){ return ""}
    n = Number(n)
    let now = new Date(n),
      y = now.getFullYear(),
      m = now.getMonth() + 1,
      d = now.getDate();
      var h = now.getHours();
    return y + "年" + (m < 10 ? "0" + m : m) + "月" + (d < 10 ? "0" + d : d) + "日" +(h < 10 ? "0" + h : h)+"时";
  }


export const getBirthday = function(n){
  if(n==""){ return ""}
  n = Number(n)
  let now = new Date(n),
    y = now.getFullYear(),
    m = now.getMonth() + 1,
    d = now.getDate();
  return y + "年" + (m < 10 ? "0" + m : m) + "月" + (d < 10 ? "0" + d : d)+"日";
}

export const getTimeSub = function(faultDate, completeTime) {
  var stime = Date.parse(new Date(faultDate));
  var etime = Date.parse(new Date(completeTime));
  // 两个时间戳相差的毫秒数
  var usedTime = etime - stime;
  // 计算相差的天数  
  var days = Math.floor(usedTime / (24 * 3600 * 1000));
  var time = days + "天";
  return time
}
